package tw.com.softleader.reins.demo.car.app;

import java.util.List;

import tw.com.softleader.reins.demo.car.dao.CarDAOjdbc;
import tw.com.softleader.reins.demo.car.entity.Car;

public class CarApp2 {
	public static void main(String[] args){
		CarDAOjdbc carDAOjdbc = new CarDAOjdbc();
		List<Car> cars = carDAOjdbc.selectAll();
		Car car = carDAOjdbc.selectById(2);
		System.out.println("--------------Get All---------------------------");
		System.out.printf("Id\t Seats\t Power\t Brand\t Color\n");
		
		for(Car cari:cars){
			System.out.printf("%3d\t %3d\t %.2f\t %s\t %s\n",cari.getId(),cari.getSeats(),cari.getPower(),cari.getBrand(),cari.getColor());
		}
		
		System.out.println("\n--------------Get By Brand---------------------------");
		System.out.printf("Id\t Seats\t Power\t Brand\t Color\n");
		System.out.printf("%3d\t %3d\t %.2f\t %s\t %s\n",car.getId(),car.getSeats(),car.getPower(),car.getBrand(),car.getColor());
	}
}
